package com.xiaojiu.util;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Map;

/**
 * Created by Jacky on 2016/12/12.
 */

public class StringUtils {
    public static String Joint(String url, Map<String, String> params) {
        if (url.indexOf("?") < 0) {
            url += "?";
        }
        if (params != null) {
            for (String name : params.keySet()) {
                try {
                    url += "&" + name + "="
                            + URLEncoder.encode(params.get(name), "UTF-8");

                } catch (UnsupportedEncodingException e) {
                    System.out.println("Joint===" + e.getMessage());

                    e.printStackTrace();
                }
            }
        }
        return url;
    }

}
